<template>
  <div class="wrapper">
    <Header />
    <Sidebar />
    <div class="content-box" :class="{ 'content-collapse': sidebarStore.collapse }">
      <Tabs></Tabs>
      <div class="content">
        <router-view v-slot="{ Component }">
          <transition name="move" mode="out-in">
            <keep-alive :include="tabsStore.nameList">
              <component :is="Component"></component>
            </keep-alive>
          </transition>
        </router-view>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
  import { useSidebarStore } from '@/store/sidebar.ts'
  import { useTabsStore } from '@/store/tabs.ts'

  import Header from '@/components/common/Header.vue'
  import Sidebar from '@/components/common/Sidebar.vue'
  import Tabs from '@/components/common/Tabs.vue'

  const sidebarStore = useSidebarStore()
  const tabsStore = useTabsStore()
</script>

<style>
  .wrapper {
    height: 100vh;
    overflow: hidden;
  }

  .content-box {
    position: absolute;
    left: 250px;
    right: 0;
    top: 70px;
    bottom: 0;
    padding-bottom: 30px;
    -webkit-transition: left 0.3s ease-in-out;
    transition: left 0.3s ease-in-out;
    background: #eef0fc;
    overflow: hidden;
  }

  .content {
    width: auto;
    height: 100%;
    padding: 20px;
    overflow-y: scroll;
    box-sizing: border-box;
  }

  .content::-webkit-scrollbar {
    width: 0;
  }

  .content-collapse {
    left: 65px;
  }
</style>
